<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:test="http://abc.com/test"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-12-12T00:00:00" />
    </reg:owner>
  </owners>

  <number>90506</number>

  <name>Function test for xfi:fact-footnotes</name>

  <documentation>
    <xhtml:p>
      Tests of function xfi:fact-footnotes($item as element(), $linkrole as xs:string?, $arcrole as xs:string, $footnoterole as xs:string?, $lang as xs:string) as xs:string
      </xhtml:p>
  </documentation>

  <reference xlink:type="simple" xlink:href="http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670666"/>

  <variation id="V-01">
    <name>Fact 1, link role default, arcrole default, footnoterole default</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V01" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V01">
       xfi:fact-footnotes(//test:X[1],
                              '',
                              '',
                              '',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and
         $result eq 'Footnote abc and def'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-01a">
    <name>Same as V-01 but empty sequence used to infer default roles</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V01a" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V01">
       xfi:fact-footnotes(//test:X[1],
                              (),
                              (),
                              (),
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and
         $result eq 'Footnote abc and def'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Fact 2, link role default, arcrole default, footnoterole default</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V02" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V02">
       xfi:fact-footnotes(//test:X[2],
                              '',
                              '',
                              '',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 2 and
         index-of($result, 'Footnote abc and def') and
         index-of($result, 'Footnote def only')
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Fact 1, link role custom, arcrole default, footnoterole default</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V03" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V03">
       xfi:fact-footnotes(//test:X[1],
                              'http://abc.com/role/link1',
                              '',
                              '',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and
         $result eq 'Footnote link1 abc'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Fact 2, link role custom, arcrole default, footnoterole default</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V04" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V04">
       xfi:fact-footnotes(//test:X[2],
                              'http://abc.com/role/link1',
                              '',
                              '',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and
         $result eq 'Footnote link1 def'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Fact 1, link role custom, arcrole custom, footnoterole default</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V05" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V05">
       xfi:fact-footnotes(//test:X[1],
                              'http://abc.com/role/link2',
                              'http://abc.com/arcrole/footnote-test',
                              '',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and
         $result eq 'Footnote link2 note1'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06">
    <name>Fact 2, link role custom, arcrole custom, footnoterole default</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V06" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V06">
       xfi:fact-footnotes(//test:X[2],
                              'http://abc.com/role/link2',
                              'http://abc.com/arcrole/footnote-test',
                              '',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and
         $result eq 'Footnote link2 note2'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-07">
    <name>Fact 1, link role custom, arcrole custom, footnoterole custom</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V07" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V07">
       xfi:fact-footnotes(//test:X[1],
                              'http://abc.com/role/link2',
                              'http://abc.com/arcrole/footnote-test',
                              'http://abc.com/role/link3',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         empty($result)
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-08">
    <name>Fact 2, link role custom, arcrole custom, footnoterole custom</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
    </documentation>
      
    <inputs>
      <schema xlink:type="simple" xlink:href="fact-footnotes-test1.xsd"/>
      <instance readMeFirst="true" id="V08" xlink:type="simple" xlink:href="footnotes-instance.xml"/>
     <cfcn:call file="V08">
       xfi:fact-footnotes(//test:X[2],
                              'http://abc.com/role/link2',
                              'http://abc.com/arcrole/footnote-test',
                              'http://abc.com/role/link3',
                              'en')
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         count($result) eq 1 and
         $result eq 'Footnote link2 note3'
      </cfcn:test>
    </outputs>
  </variation>


  <revisions>
    <reg:revision on="2008-12-12T00:00:00" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2010-09-09T00:00:00" by="herm">
      <xhtml:p>
        Changed role URIs to strings for cast-less coding and to be similar to fn:QName's $paramURI, an xs:string.
      </xhtml:p>
    </reg:revision>
    
    <reg:revision on="2011-03-18T09:00:00" by="herm">
      <xhtml:p>
        Added test case V-01a for inferring default roles from empty sequence.
      </xhtml:p>
    </reg:revision>
  </revisions>

</testcase>




